export default{
  namespaced:true,
  state:{
    //当前导航所处位置的ID
    navId:1,//默认为首页
    //当前所选择的城市
    cityId:2,//默认为成都
    //导航分类
    classifyList:uni.getStorageSync("classifyList")||[],
    //封面数据
    coverData:JSON.parse(uni.getStorageSync("coverData")||"{}"),
    // 为true时显示中文
    flag:true,
  },
  mutations:{
    //设置flag
    setFlag(state,flag){
      state.flag = flag
    },
    //设置当前所选择的城市ID
    setCityId(state,id){
      state.cityId = id
    },
    //设置当前导航ID
    setNavID(state,navId){
      state.navId = navId
    },
    //设置导航分类
    setClassifyList(state,list){
      state.classifyList = list
      this.commit("style/saveClassifyList")
    },
    //设置封面数据
    setCoverData(state,data){
      state.coverData = data
      this.commit("style/saveCoverData")
    },
    //持久化封面数据
    saveCoverData(state){
      uni.setStorageSync("coverData",JSON.stringify(state.coverData))
    },
    //持久化导航分类
    saveClassifyList(state){
      uni.setStorageSync("classifyList",state.classifyList)
    }
  }
}